import { TestReq, TestRes } from "./gen/test_pb";
import * as grpc from "@grpc/grpc-js";
import { TestClient, TestService } from "./gen/test_grpc_pb";

const client = new TestClient("localhost:3333", grpc.credentials.createInsecure());
const testReq = new TestReq();
testReq.setName("client");
const call = client.sayTest();
call.on("data", (data: any) => {
    console.log("data: ", data);
    setTimeout(() => {
        call.write(testReq);
    }, 1000);
});

call.write(testReq);